package com.zhangyj.impl.component.type;

public class CheckBox {
	private String name;
	private String value;
	private boolean isChecked;

	public CheckBox() {
		name = null;
		value = null;
		isChecked = false;
	}

	public CheckBox(String name, String value,boolean isChecked) {
		setName(name);
		setValue(value);
		setChecked(isChecked);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public boolean isChecked() {
		return isChecked;
	}

	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
	}

	public String toString() {
		StringBuilder writer = new StringBuilder();
		writer.append("<input type=\"checkbox\" name=\"").append(getName()).append("\"");
		if (this.isChecked) {
			writer.append(" checked=\"checked\"");
		}
		writer.append(" value=\"").append(getValue()).append("\"/>");
		return writer.toString();
	}
}
